package com.zkr.legalperson.mapper;

import com.zkr.legalperson.model.LegalPersonSelectVo;
import com.zkr.legalperson.model.LegalPersonVo;
import com.zkr.legalperson.model.LegalPlantClassVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by lenovo on 2020/12/16.
 */
@Mapper
public interface LagalPersonMapper {


    List<LegalPlantClassVo> query(LegalPersonSelectVo legalPersonSelectVo);

    int queryCount(LegalPersonSelectVo planClassSelectVo);

    void updateStatus(LegalPlantClassVo legalPlantClassVo);

    @Select("select * from legalplant where legalPlantCode=#{legalPlantCode}")
    LegalPlantClassVo queryByCode(String legalPersonCode);


    @Insert("insert into legalplant(legalPlantCode,legalPlantDec,legalPersonCode,enabled,createTime,createName,updateTime,updateName) "+
            "values (#{legalPlantCode},#{legalPlantDec},#{legalPersonCode},#{enabled},#{createTime},#{createName},#{updateTime},#{updateName}) ")
    void insertPlantClass(LegalPlantClassVo legalPlantClassVo);

    @Select("select *,legalPersonId id from legalperson  where userId = #{userid} ")
    List<LegalPersonVo> queryLegalPersonById(Integer userid);

    void update(LegalPlantClassVo legalPlantClassVo1);

    @Select("select * from legalplant where legalPlantCode=#{legalPlantCode}")
    LegalPlantClassVo queryById(@NotBlank(message = "工厂编码不能为空!") String legalPlantCode);

}
